<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <title>申诉审核</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../css/admin.css">
    <link rel="stylesheet" href="../css/examine.css">
    <link rel="stylesheet" href="../fonts/iconfont.css">
</head>
<style>
            .container{
                display: flex;
                background-color:#F3F3F3;
            }
            .detail{
                height:600px;
            }
            .layui-table[lay-skin=line] td, .layui-table[lay-skin=line] th{
                background-color:#fff;
            }
            .layui-table td, .layui-table th{
                padding:14px 15px;
            }
            form{
                float:left;
                margin-top:10px;
                display: inline-block;
            }
            .right-top input{
                color:#777;
                float: left;
                width: 120px;
                height: 28px;
                margin-top:8px;
                font-size:12px;
                margin-left:9px;
                padding-left: 5px;
                border-radius: 5px;
                border: 1px solid #EF7632;
            }
            .layui-layer-btn,.layui-layer-content{
                text-align:center;
            }
            #search_box{
                display:inline-block;
                margin-top:9px;
            }
            #search{
                display:inline-block;
                margin-top:9px;
            }
            #reject{
               margin-left:3px;
            }
            #reject:hover{
                background-color: orangered;
            }
            #pass:hover{
                background-color:forestgreen;
            }
</style>
<body>

<div class="container">
    <!-- 左边选项栏 -->
    <div class="org-floor">
        <ul id="navtree"> </ul>
    </div>
    <!-- 列表-->
    <div class="section-right">
        <div class="right-top">
            <input type="text" name="account" id="account"  value=""  placeholder="按账号搜索"  onfocus="this.style.color='#888';"  onblur="this.style.color='#777';"/>
            <div id="search" style="cursor: pointer;"><i class="layui-icon" style="font-size: 25px; color: #EF7632;">&#xe615;</i> </div>

           <button class="layui-btn layui-btn-normal  add right"><span class="pic-4 iconfont icon-shenhebiao"></span>申诉处理</button>
        </div>
        <!--  table部分 -->
        <div class="detail">
            <table class="layui-table" lay-skin="line"  id="table">
                <thead>
                <tr>
                    <th></th>
                    <th>小区名称</th>
                    <th>单元名称</th>
                    <th>用户账号</th>
                    <th>乘梯时间</th>
                    <th>申诉时间</th>
                    <th>状&emsp;态</th>
                    <th>申诉处理</th>
                </tr>
                </thead>
                <tbody class="org-table">
                </tbody>
            </table>
            <div id="page-fen">
                <div id="page-num"></div>
            </div>
        </div>
    </div>
</div>
<script src="../lib/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="../layui/layui.js"></script>
<script src="../lib/js/jquery.cookie.js" type="text/javascript"></script>
<script>
    layui.use(['jquery','form','layer','laypage','tree'], function() {
        var $ = layui.jquery;
        var form = layui.form();
            layer = layui.layer;
        var laypage = layui.laypage;

        var user_id = localStorage.getItem("user_id");
        console.log(user_id);

        var account=$("#account").val();
        var account="";
        var params = {};
//查询小区的
        $("#search").off("click").on("click",function(){
            console.log(123);
            account = $.trim($("#account").val());
            searchTable();
        });
//回车搜索
        $("#account").on('keydown', function(e){
            if(e.keyCode == 13){
                account = $.trim($("#account").val());
                searchTable();
            }
        });
        review();;
        function review(chengti_id){
            if(chengti_id){
                $.ajax({
                    url: '../../building_manage/batchDealComplain',
                    type: 'get',
                    dataType: 'json',
                    data:{
                        chengti_id :chengti_id,
                        status:params.status
                    }
                })
                    .done(function(response) {
                        console.log("success",response);
                        window.location.reload();
                        layer.closeAll();
                    })
                    .fail(function(response) {
                        console.log("error",response);
                        window.location.reload();
                        layer.closeAll();
                    });
            }
        };

        var pages={};
        searchTable();
        function searchTable(curr){
            $.ajax({
                url: '../../building_manage/queryChengtiComplainByTel',
                traditional: true,
                type: 'get',
                dataType: 'json',
                data: {
                    wuye_id: user_id,
                    tel:account,
                    current_page:curr || 1,
                    limit:10,
                }
            })
                .done(function (response) {
                    console.log(response);

                    if (response.resultCode == 200) {
                        var str = '';
                        var data = response.page.list;

                        if (response.page.list.length) {
                            for (var i = 0; i < response.page.list.length; i++) {
                                var status_ap='';
                                var resultBox='';
                                      if(data[i].status == 0){
                                          status_ap +=
                                              '<span style="">'+"申诉中"+'<span>'
                                          resultBox +=
                                              '<button type="button" id="pass" data-name="2" data-id="'+data[i].chengti_id +'">'+"通过"+'</button><button type="button" id="reject" data-name="1" data-id="'+data[i].chengti_id +'" >'+"驳回"+'</button>'

                                      }else if(data[i].status == 1){
                                          status_ap +=
                                              '<span style="color:#52689F">'+"驳回"+'<span>'
                                          resultBox +=
                                              '<span id="result">'+'已处理'+'</span>'
                                      }else if(data[i].status == 2){
                                          status_ap +=
                                              '<span style="color:#B8664D">'+"同意"+'<span>'
                                          resultBox +=
                                              '<span id="result">'+'已处理'+'</span>'
                                      }
                                str +=
                                    '<tr data-id="'+ data[i].chengti_id +'">'+
                                    '<td class="check"><input data-id="'+data[i].chengti_id +'"  type="radio" name="items" title="" lay-skin="primary"></td>'+
                                    '<td>'+ response.page.list[i].building_name +'</td>'+
                                    '<td>'+ response.page.list[i].zhuang_danyuan +'</td>'+
                                    '<td>'+ response.page.list[i].account+'</td>'+
                                    '<td>'+ response.page.list[i].chengti_time+'</td>'+
                                    '<td>'+ response.page.list[i].complain_time+'</td>'+
                                    '<td>'+ status_ap+'</td>'+
                                    '<td>'+resultBox+'</td>'+
                                    '</tr>'
                            }
                            $(".org-table").html(str);

                            $("td button").click(function(){
                                var status= $(this).data("name");

                                params.status = status;
                                var chengti_id= $(this).data("id");

                                review(chengti_id);
                                params.chengti_id = chengti_id;
                            });
                            pages.total = response.page.total;
                            console.log(pages.total);

                            pages.current_page = response.page.current_page;
                            console.log(pages.current_page);

                            pages.totalPages = Math.ceil(pages.total/10);

                            laypage({
                                cont: 'page-num'
                                ,pages: pages.totalPages     //通过后台拿到的总页数
                                // skip: true, 是否开启跳页
                                ,curr: pages.current_page  //当前页
                                ,first: false
                                ,last:false
                                ,prev: '<em><</em>'
                                ,next: '<em>></em>'
                                ,jump: function(obj, first){ //触发分页后的回调
                                    var curr = obj.curr;
                                    console.log(curr);
                                    if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                                        searchTable(curr);
                                    }
                                }
                            })
                        }
                        else {
                            str = '<tr><td colspan="7">暂无数据</td></tr>';
                            $(".org-table").html(str);
                        }
                    }//200
                })//done
                .fail(function (response) {
                    console.log("fail", response);
                    if (response.resultCode == '001') {
                        console.log("param is not found");
                    } else if (response.resultCode == '009') {
                        console.log("String is not int type");
                    }
                })//fail
        }
//左侧导航栏部分
        dysou();
        function dysou(){
            $.ajax({
                url:'../../organization_manage/getProvinceByWuyeId',
                type: 'GET',
                dataType: "json",
                data:{
                    wuye_id: user_id
                }
            })
                .done(function(response){
                    console.log(response);

                    if(response.resultCode==200){
                        var  data = response.provinces;
                        console.log(data);

                        layui.tree({
                            elem: '#navtree',
                            skin: 'as',
                            drag: true,
                            click: function(id) {

                                var attR =["province_id","city_id","district_id","building_id","danyuan_id","id"];
                                var attr = [];
                                for(var k in id) {
                                    attr.push(k);
                                }
                                for(var j=0;j<attR.length; j++){
                                    for(var m=0;m<attr.length;m++){
                                        if(attR[j] == attr[m]){

                                            var typeName = attr[m];
                                            localStorage.setItem("typeName",typeName);
                                            if(typeName == "province_id"){
                                                var province_id = id.province_id;
                                                params.province_id = province_id;
                                                localStorage.setItem("provinceId",province_id);
                                                console.log(province_id);
                                                getByprovince();

                                            }else if(typeName == "city_id"){
                                                var city_id = id.city_id;
                                                params.city_id = city_id;
                                                localStorage.setItem("cityId",city_id);
                                                console.log(city_id);
                                                getBycity();

                                            }else if(typeName == "district_id"){
                                                var district_id = id.district_id;
                                                params.district_id = district_id;
                                                localStorage.setItem("districtId",district_id);
                                                console.log(district_id);
                                                getBydistrict();

                                            }else if(typeName == "building_id"){
                                                var building_id = id.building_id;
                                                params.building_id = building_id;
                                                localStorage.setItem("buildingId",building_id);
                                                console.log(building_id);
                                                getBybuilding();

                                            }else if(typeName == "id"){
                                                var danyuan_id = id.id;
                                                params.danyuan_id = danyuan_id;
                                                localStorage.setItem("danyuanId",danyuan_id);
                                                console.log(danyuan_id);
                                                getBydanyuan();
                                            }
                                        }//if
                                    }//for
                                }//for
                                $("body").on("mousedown",".layui-tree a cite",function(){
                                    $(".layui-tree a cite").css('color','#2C283C')
                                    $(this).css('color','#FABB42')
                                });
 //依据省id查
                                function getByprovince(currp){
                                    $.ajax({
                                        url: '../../building_manage/queryChengtiComplainByProvinceId',
                                        type: 'GET',
                                        dataType: 'json',
                                        data:{
                                            province_id:params.province_id,
                                            wuye_id:user_id,
                                            current_page:currp||1,
                                            limit:10
                                        }
                                    })
                                        .done(function (response) {
                                            console.log("province",response);
                                            var data = response.page.list;

                                            if (response.resultCode == 200) {
                                                var str = '';
                                                var data = response.page.list;

                                                if (response.page.list.length) {
                                                    for (var i = 0; i < response.page.list.length; i++) {
                                                        var status_ap='';
                                                        var resultBox='';
                                                        if(data[i].status == 0){
                                                            status_ap +=
                                                                '<span style="">'+"申诉中"+'<span>'
                                                            resultBox +=
                                                                '<button type="button" id="pass" data-name="2" data-id="'+data[i].chengti_id +'">'+"通过"+'</button><button type="button" id="reject" data-name="1" data-id="'+data[i].chengti_id +'" >'+"驳回"+'</button>'

                                                        }else if(data[i].status == 1){
                                                            status_ap +=
                                                                '<span style="color:#52689F">'+"驳回"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }else if(data[i].status == 2){
                                                            status_ap +=
                                                                '<span style="color:#B8664D">'+"同意"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }
                                                        str +=
                                                            '<tr data-id="'+ data[i].chengti_id +'">'+
                                                            '<td class="check"><input data-id="'+data[i].chengti_id +'"  type="radio" name="items" title="" lay-skin="primary"></td>'+
                                                            '<td>'+ response.page.list[i].building_name +'</td>'+
                                                            '<td>'+ response.page.list[i].zhuang_danyuan +'</td>'+
                                                            '<td>'+ response.page.list[i].account+'</td>'+
                                                            '<td>'+ response.page.list[i].chengti_time+'</td>'+
                                                            '<td>'+ response.page.list[i].complain_time+'</td>'+
                                                            '<td>'+ status_ap+'</td>'+
                                                            '<td>'+resultBox+'</td>'+
                                                            '</tr>'
                                                    }
                                                    $(".org-table").html(str);
                                                    show();


                                                    $("td button").click(function(){
                                                        var status= $(this).data("name");

                                                        params.status = status;
                                                        var chengti_id= $(this).data("id");
                                                        review(chengti_id);
                                                    });

                                                    pages.total = response.page.total;
                                                    console.log(pages.total);

                                                    pages.current_page = response.page.current_page;
                                                    console.log(pages.current_page);

                                                    pages.totalPages = Math.ceil(pages.total/10);
                                                    /*显示分页*/
                                                    laypage({
                                                        cont: 'page-num'
                                                        ,pages: pages.totalPages     //通过后台拿到的总页数
                                                        // skip: true, 是否开启跳页
                                                        ,curr: pages.current_page  //当前页
                                                        ,first: false
                                                        ,last:false
                                                        ,prev: '<em><</em>'
                                                        ,next: '<em>></em>'
                                                        ,jump: function(obj, first){ //触发分页后的回调
                                                            var currp = obj.curr;
                                                            console.log(currp);
                                                            localStorage.setItem("currp",currp);
                                                            if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                                                                getByprovince(currp);
                                                            }
                                                        }
                                                    })
                                                }
                                                else {
                                                    str = '<tr><td colspan="7">暂无数据</td></tr>';
                                                    $(".org-table").html(str);
                                                    hidden();
                                                }
                                            }//200
                                        })//done
                                        .fail(function(response){
                                            console.log("fail",response);
                                            if(resultCode='001'){
                                                console.log("param is not found");
                                            }else if(resultCode='009'){
                                                console.log("String is not int type");
                                            }
                                        });//fail
                                }
            //依据市 id查询
                                function getBycity(currc){
                                    $.ajax({
                                        url: '../../building_manage/queryChengtiComplainByCityId',
                                        type: 'GET',
                                        dataType: 'json',
                                        data:{
                                            city_id:params.city_id,
                                            wuye_id:user_id,
                                            current_page:currc || 1,
                                            limit:10
                                        }
                                    })
                                        .done(function(response) {
                                            console.log('success',response);
                                            var data = response.page.list;

                                            if (response.resultCode == 200) {
                                                var str = '';
                                                var data = response.page.list;

                                                if (response.page.list.length) {
                                                    for (var i = 0; i < response.page.list.length; i++) {
                                                        var status_ap='';
                                                        var resultBox='';
                                                        if(data[i].status == 0){
                                                            status_ap +=
                                                                '<span style="">'+"申诉中"+'<span>'
                                                            resultBox +=
                                                                '<button type="button" id="pass" data-name="2" data-id="'+data[i].chengti_id +'">'+"通过"+'</button><button type="button" id="reject" data-name="1" data-id="'+data[i].chengti_id +'" >'+"驳回"+'</button>'

                                                        }else if(data[i].status == 1){
                                                            status_ap +=
                                                                '<span style="color:#52689F">'+"驳回"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }else if(data[i].status == 2){
                                                            status_ap +=
                                                                '<span style="color:#B8664D">'+"同意"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }
                                                        str +=
                                                            '<tr data-id="'+ data[i].chengti_id +'">'+
                                                            '<td class="check"><input data-id="'+data[i].chengti_id +'"  type="radio" name="items" title="" lay-skin="primary"></td>'+
                                                            '<td>'+ response.page.list[i].building_name +'</td>'+
                                                            '<td>'+ response.page.list[i].zhuang_danyuan +'</td>'+
                                                            '<td>'+ response.page.list[i].account+'</td>'+
                                                            '<td>'+ response.page.list[i].chengti_time+'</td>'+
                                                            '<td>'+ response.page.list[i].complain_time+'</td>'+
                                                            '<td>'+ status_ap+'</td>'+
                                                            '<td>'+resultBox+'</td>'+
                                                            '</tr>'
                                                    }
                                                    $(".org-table").html(str);
//分页显示
                                                    show();
                                                    $("td button").click(function(){
                                                        var status= $(this).data("name");

                                                        params.status = status;
                                                        var chengti_id= $(this).data("id");

                                                        review(chengti_id);
                                                        params.chengti_id = chengti_id;
                                                    });
                                                    pages.total = response.page.total;
                                                    localStorage.setItem("total",response.page.total);

                                                    pages.current_page = response.page.current_page;
                                                    pages.totalPages = Math.ceil(pages.total/10);

                                                    laypage({
                                                        cont: 'page-num'
                                                        ,pages: pages.totalPages
                                                        ,curr: pages.current_page
                                                        ,first: 1
                                                        ,last:false
                                                        ,prev: '<em><</em>'
                                                        ,next: '<em>></em>'
                                                        ,jump: function(obj, first){
                                                            var currc = obj.curr;
                                                            console.log(currc);
                                                            localStorage.setItem("currc",currc);
                                                            if(!first){
                                                                getBycity(currc);
                                                            }
                                                        }
                                                    })
                                                }
                                                else{
                                                    str = '<tr><td colspan="7">暂无数据</td></tr>';
                                                    $(".org-table").html(str);
                                                    hidden();
                                                }//else
                                            }//200
                                        })//done
                                        .fail(function(response){
                                            console.log("fail",response);
                                            if(resultCode='001'){
                                                console.log("param is not found");
                                            }else if(resultCode='009'){
                                                console.log("String is not int type");
                                            }
                                        });//fail
                                }
                    //依据区 id查询

                                function getBydistrict(currdi){
                                    $.ajax({
                                        url: '../../building_manage/queryChengtiComplainByDistrictId',
                                        type: 'GET',
                                        dataType: 'json',
                                        data:{
                                            district_id:params.district_id,
                                            wuye_id:user_id,
                                            current_page:currdi || 1,
                                            limit:10
                                        }
                                    })
                                        .done(function(response) {
                                            console.log("success",response);
                                            var data = response.page.list;

                                            if (response.resultCode == 200) {
                                                var str = '';
                                                var data = response.page.list;

                                                if (response.page.list.length) {
                                                    for (var i = 0; i < response.page.list.length; i++) {
                                                        var status_ap='';
                                                        var resultBox='';
                                                        if(data[i].status == 0){
                                                            status_ap +=
                                                                '<span style="">'+"申诉中"+'<span>'
                                                            resultBox +=
                                                                '<button type="button" id="pass" data-name="2" data-id="'+data[i].chengti_id +'">'+"通过"+'</button><button type="button" id="reject" data-name="1" data-id="'+data[i].chengti_id +'" >'+"驳回"+'</button>'

                                                        }else if(data[i].status == 1){
                                                            status_ap +=
                                                                '<span style="color:#52689F">'+"驳回"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }else if(data[i].status == 2){
                                                            status_ap +=
                                                                '<span style="color:#B8664D">'+"同意"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }
                                                        str +=
                                                            '<tr data-id="'+ data[i].chengti_id +'">'+
                                                            '<td class="check"><input data-id="'+data[i].chengti_id +'"  type="radio" name="items" title="" lay-skin="primary"></td>'+
                                                            '<td>'+ response.page.list[i].building_name +'</td>'+
                                                            '<td>'+ response.page.list[i].zhuang_danyuan +'</td>'+
                                                            '<td>'+ response.page.list[i].account+'</td>'+
                                                            '<td>'+ response.page.list[i].chengti_time+'</td>'+
                                                            '<td>'+ response.page.list[i].complain_time+'</td>'+
                                                            '<td>'+ status_ap+'</td>'+
                                                            '<td>'+resultBox+'</td>'+
                                                            '</tr>'
                                                    }
                                                    $(".org-table").html(str);
//分页显示
                                                    show();

                                                    $("td button").click(function(){
                                                        var status= $(this).data("name");

                                                        params.status = status;
                                                        var chengti_id= $(this).data("id");

                                                        review(chengti_id);
                                                        params.chengti_id = chengti_id;
                                                    });

                                                    pages.total = response.page.total;
                                                    localStorage.setItem("total",response.page.total);

                                                    pages.current_page = response.page.current_page;
                                                    pages.totalPages = Math.ceil(pages.total/10);

                                                    laypage({
                                                        cont: 'page-num'
                                                        ,pages: pages.totalPages
                                                        ,curr: pages.current_page
                                                        ,first: 1
                                                        ,last:false
                                                        ,prev: '<em><</em>'
                                                        ,next: '<em>></em>'
                                                        ,jump: function(obj, first){
                                                            var currdi = obj.curr;
                                                            console.log(currdi);
                                                            localStorage.setItem("currdi",currdi);
                                                            if(!first){
                                                                getBydistrict(currdi);
                                                            }
                                                        }
                                                    })
                                                }
                                                else{
                                                    str = '<tr><td colspan="7">暂无数据</td></tr>';
                                                    $(".org-table").html(str);
                                                    hidden();

                                                }//else
                                            }//200
                                        })//done
                                        .fail(function(response){
                                            console.log("fail",response);
                                            if(resultCode='001'){
                                                console.log("param is not found");
                                            }else if(resultCode='009'){
                                                console.log("String is not int type");
                                            }
                                        });//fail
                                }
             //依据小区id查询

                                function getBybuilding(currb){
                                    $.ajax({
                                        url: '../../building_manage/queryChengtiComplainByBuildingId',
                                        type: 'GET',
                                        dataType: 'json',
                                        data:{
                                            building_id:params.building_id,
                                            current_page:currb || 1,
                                            limit:10,
                                        }
                                    })
                                        .done(function(response) {
                                            console.log("success",response);
                                            var data = response.page.list;

                                            if (response.resultCode == 200) {
                                                var str = '';
                                                var data = response.page.list;

                                                if (response.page.list.length) {
                                                    for (var i = 0; i < response.page.list.length; i++) {
                                                        var status_ap='';
                                                        var resultBox='';
                                                        if(data[i].status == 0){
                                                            status_ap +=
                                                                '<span style="">'+"申诉中"+'<span>'
                                                            resultBox +=
                                                                '<button type="button" id="pass" data-name="2" data-id="'+data[i].chengti_id +'">'+"通过"+'</button><button type="button" id="reject" data-name="1" data-id="'+data[i].chengti_id +'" >'+"驳回"+'</button>'

                                                        }else if(data[i].status == 1){
                                                            status_ap +=
                                                                '<span style="color:#52689F">'+"驳回"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }else if(data[i].status == 2){
                                                            status_ap +=
                                                                '<span style="color:#B8664D">'+"同意"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }
                                                        str +=
                                                            '<tr data-id="'+ data[i].chengti_id +'">'+
                                                            '<td class="check"><input data-id="'+data[i].chengti_id +'"  type="radio" name="items" title="" lay-skin="primary"></td>'+
                                                            '<td>'+ response.page.list[i].building_name +'</td>'+
                                                            '<td>'+ response.page.list[i].zhuang_danyuan +'</td>'+
                                                            '<td>'+ response.page.list[i].account+'</td>'+
                                                            '<td>'+ response.page.list[i].chengti_time+'</td>'+
                                                            '<td>'+ response.page.list[i].complain_time+'</td>'+
                                                            '<td>'+ status_ap+'</td>'+
                                                            '<td>'+resultBox+'</td>'+
                                                            '</tr>'
                                                    }
                                                    $(".org-table").html(str);
                                                    show();
                                                    $("td button").click(function(){
                                                        var status= $(this).data("name");

                                                        params.status = status;
                                                        var chengti_id= $(this).data("id");

                                                        review(chengti_id);
                                                        params.chengti_id = chengti_id;
                                                    });
                                                    //分页显示
                                                    pages.total = response.page.total;
                                                    localStorage.setItem("total",response.page.total);

                                                    pages.current_page = response.page.current_page;
                                                    pages.totalPages = Math.ceil(pages.total/10);

                                                    laypage({
                                                        cont: 'page-num'
                                                        ,pages: pages.totalPages
                                                        ,curr: pages.current_page
                                                        ,first: 1
                                                        ,last:false
                                                        ,prev: '<em><</em>'
                                                        ,next: '<em>></em>'
                                                        ,jump: function(obj, first){ //触发分页后的回调
                                                            var currb = obj.curr;
                                                            console.log(currb);
                                                            localStorage.setItem("currb",currb);
                                                            if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                                                                getBybuilding(currb);
                                                            }
                                                        }
                                                    });

                                                }else{
                                                    str = '<tr><td colspan="7">暂无数据</td></tr>';
                                                    $(".org-table").html(str);
                                                    hidden();
                                                }//else
                                            }//200
                                        })//done
                                        .fail(function(response){
                                            console.log("fail",response);
                                            if(resultCode='001'){
                                                console.log("param is not found");
                                            }else if(resultCode='009'){
                                                console.log("String is not int type");
                                            }
                                        });//fail
                                }
             //依据单元i//查询
                                function getBydanyuan(currd){
                                    $.ajax({
                                        url: '../../building_manage/queryChengtiComplainByDanyuanId',
                                        type: 'GET',
                                        dataType: 'json',
                                        data:{
                                            danyuan_id:params.danyuan_id,
                                            current_page:currd || 1,
                                            limit:10,
                                        }
                                    })
                                        .done(function(response) {
                                            console.log("success",response);
                                            var data = response.page.list;

                                            if (response.resultCode == 200) {
                                                var str = '';
                                                var data = response.page.list;

                                                if (response.page.list.length) {
                                                    for (var i = 0; i < response.page.list.length; i++) {
                                                        var status_ap='';
                                                        var resultBox='';
                                                        if(data[i].status == 0){
                                                            status_ap +=
                                                                '<span style="">'+"申诉中"+'<span>'
                                                            resultBox +=
                                                                '<button type="button" id="pass" data-name="2" data-id="'+data[i].chengti_id +'">'+"通过"+'</button><button type="button" id="reject" data-name="1" data-id="'+data[i].chengti_id +'" >'+"驳回"+'</button>'

                                                        }else if(data[i].status == 1){
                                                            status_ap +=
                                                                '<span style="color:#52689F">'+"驳回"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }else if(data[i].status == 2){
                                                            status_ap +=
                                                                '<span style="color:#B8664D">'+"同意"+'<span>'
                                                            resultBox +=
                                                                '<span id="result">'+'已处理'+'</span>'
                                                        }
                                                        str +=
                                                            '<tr data-id="'+ data[i].chengti_id +'">'+
                                                            '<td class="check"><input data-id="'+data[i].chengti_id +'"  type="radio" name="items" title="" lay-skin="primary"></td>'+
                                                            '<td>'+ response.page.list[i].building_name +'</td>'+
                                                            '<td>'+ response.page.list[i].zhuang_danyuan +'</td>'+
                                                            '<td>'+ response.page.list[i].account+'</td>'+
                                                            '<td>'+ response.page.list[i].chengti_time+'</td>'+
                                                            '<td>'+ response.page.list[i].complain_time+'</td>'+
                                                            '<td>'+ status_ap+'</td>'+
                                                            '<td>'+resultBox+'</td>'+
                                                            '</tr>'
                                                    }
                                                    $(".org-table").html(str);
                                                    //分页显示
                                                    show();
                                                    $("td button").click(function(){
                                                        var status= $(this).data("name");

                                                        params.status = status;
                                                        var chengti_id= $(this).data("id");

                                                        review(chengti_id);
                                                        params.chengti_id = chengti_id;
                                                    });

                                                    pages.total = response.page.total;
                                                    console.log(pages.total);

                                                    localStorage.setItem("total",response.page.total);

                                                    pages.current_page = response.page.current_page;

                                                    pages.totalPages = Math.ceil(pages.total/10);

                                                    laypage({
                                                        cont: 'page-num'
                                                        ,pages: pages.totalPages
                                                        ,curr: pages.current_page
                                                        ,first: 1
                                                        ,last:false
                                                        ,prev: '<em><</em>'
                                                        ,next: '<em>></em>'
                                                        ,jump: function(obj, first){ //触发分页后的回调
                                                            var currd = obj.curr;
                                                            localStorage.setItem("currd",currd);
                                                            if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                                                                getBydanyuan(currd);
                                                            }
                                                        }
                                                    })
                                                }
                                                else{
                                                    str = '<tr><td colspan="7">暂无数据</td></tr>';
                                                    $(".org-table").html(str);
                                                    hidden();

                                                }//else
                                            }//200
                                        })//done
                                        .fail(function(response){
                                            console.log("fail",response);
                                            if(resultCode='001'){
                                                console.log("param is not found");
                                            }else if(resultCode='009'){
                                                console.log("String is not int type");
                                            }
                                        });//fail
                                }
                                function show(){
                                    document.getElementById("page-fen").style.display="";
                                };
                                function hidden(){
                                    document.getElementById("page-fen").style.display="none";
                                };

                            },//click
                            onchange: function (){
                                console.log(this);
                            },
                            nodes: data
                        })//tree
                    }//200
                })//done
                .fail(function(response){
                    console.log("fail",response);
                })
        }

    });//模块加载
</script>
</body>
</html>
